OPTION EXPLICIT

Dim ExpressionToEvaluate, bFound, Debug
Debug = FALSE


'This is what goes in the condition text
ExpressionToEvaluate = "1 < 0"



if not EvalWithErrorHandling(ValidateCONFIGURATIONList) then
    bFound = FALSE
end if

if bFound then 'If bFound then we will show the node
  Wscript.Echo "The NODE WILL SHOW"
Else
  Wscript.Echo "The NODE  WILL NOT SHOW"
end if

Function EvalWithErrorHandling ( fn )
        Dim RunAgain : RunAgain = FALSE
        	
	On error resume Next
          Err.Clear
          EvalWithErrorHandling = eval(fn)
          EvalWIthErrorHandling = EvalWIthErrorHandling and (err.number = 0)
          RunAgain = DisplayErrorIfAny (fn)
	On error goto 0
	If RunAgain then
          EvalWithErrorHandling = eval(fn)
	End if 
End function 

Function DisplayErrorIfAny ( sStatement ) 
Dim sError

	If Err.Number = 0 then 'If no error occurred we just exit
                'Wscript.Echo "The Err Object has a number of 0 so we will just exit the function "
		Exit function 
	End if 
        Wscript.Echo "If this code executes then there was something in the err object"
        sError = sError & "########################################################################"  & vbNewLine
	sError = sError & "A VBScript Runtime Error has occurred: " & vbNewLine
	sError = sError & "Error: " & Err.Number & " = " & Err.Description & vbNewLine
	sError = sError & "VBScript Code  that Generated the error is on the next line:" & vbNewLine
	sError = sError & left(sStatement,800) &  vbNewLine
        sError = sError & "########################################################################"  & vbNewLine
	Wscript.Echo  sError
        
        
   	If Debug then 'If it is set to debug true, the script will ask the user to debug, 
                'if they say yes it just runs it again
		sError = sError & vbNewLine & "-------------------" &  vbNewLine 
		sError = sError & "Do you wish to attempt debugging on this script?"
		DisplayErrorIfAny = MsgBox ( sError, vbYesNo , "VBScript Runtime Error" ) = vbYes
	Else
		Alert sError
		DisplayErrorIfAny = FALSE
	End if 
      
End function



'Line 207 to 230 of Wizard.hta

'	            ' Is there a validation function defined?  If so, execute it. (unless we're moving backwards)
'	            for each oCustomScript in oNode.SelectNodes("Condition")
'	            
'	            	Wscript.Echo  "Current Condition Value = " & oCustomScript.Text
'	            
'	               if not EvalWithErrorHandling(oCustomScript.Text) then
'	                   bFound = FALSE
'	                   exit for
'	               end if
'	            next 
'			end if 
'			
'			if bFound then
'			    set oCurrentNode = oNode
'			    exit for
'			end if
'    
'		ElseIf strPane = "" and sCurrentPane = oNode.attributes(0).nodeValue then
'			bFindNext = True ' We are at the current page, find the next 
'		End if
'				
'		oNodeIndex = oNodeIndex + 1		
'		
'	next

Function ValidateCONFIGURATIONList
ON ERROR GOTO 0
    Wscript.Echo "Entered Function ValidateCONFIGURATIONList"
    
    Wscript.Echo "oNode.Attributes.getNamedItem('ConfigID').value CONTAINS: " & oNode.Attributes.getNamedItem("ConfigID").value
    
    Wscript.Echo "oNode.selectSingleNode('ID').text CONTAINS: " & oNode.Attributes.getNamedItem("ConfigID").value
    
    Wscript.Echo "oNode.selectSingleNode('ID').text CONTAINS: " & oNode.selectSingleNode("ID").text
    
    Wscript.Echo "oEnvironment.Item('IDENT') CONTAINS: " & oEnvironment.Item("IDENT")
    
    Wscript.Echo "Going  to put ID Into EDENT", LogTypeInfo
    
    ON ERROR RESUME NEXT
      oEnvironment.Item("IDENT") = oNode.selectSingleNode("ID").text
      If Err Then
        Wscript.Echo "ERROR OCCURRED: ErrNumber= " & Err.Number & " ErrDescription= " & Err.Description
        Err.Clear
      Else
        Wscript.Echo "No Issues Encountered Assigning VALUE to Property!"
      End If
    
    Wscript.Echo "oEnvironment.Item('IDENT') NOW CONTAINS: " & oEnvironment.Item("IDENT")
    
ValidateTSList = True
ButtonNext.Disabled = False
	
End Function